using System.Threading.Tasks;
using JGSY.CMS.LowCode.Platform.Application.DTOs;

namespace JGSY.CMS.LowCode.Platform.Application.Interfaces
{
    /// <summary>
    /// 双因子认证应用服务接口。
    /// 提供双因子认证的设置、验证、备份码管理等安全认证功能接口定义。
    /// </summary>
    public interface ITwoFactorAppService
    {
        /// <summary>
        /// 生成双因子认证密钥
        /// </summary>
        /// <param name="username">用户名</param>
        /// <returns>双因子认证设置结果</returns>
        Task<TwoFactorSetupResultDto> GenerateTwoFactorSecretAsync(string username);
        
        /// <summary>
        /// 验证双因子认证令牌
        /// </summary>
        /// <param name="token">认证令牌</param>
        /// <param name="secret">认证密钥</param>
        /// <returns>验证是否成功</returns>
        Task<bool> VerifyTokenAsync(string token, string secret);
        
        /// <summary>
        /// 验证备份码
        /// </summary>
        /// <param name="code">备份码</param>
        /// <param name="backupCodes">备份码数组</param>
        /// <returns>备份码验证结果</returns>
        Task<TwoFactorVerifyResultDto> VerifyBackupCodeAsync(string code, string[] backupCodes);
        
        /// <summary>
        /// 重新生成备份码
        /// </summary>
        /// <returns>新的备份码数组</returns>
        Task<string[]> RegenerateBackupCodesAsync();
        
        /// <summary>
        /// 获取双因子认证汇总信息
        /// </summary>
        /// <param name="data">双因子认证数据</param>
        /// <returns>双因子认证汇总信息</returns>
        Task<TwoFactorSummaryDto> GetTwoFactorSummaryAsync(TwoFactorDataDto data);
    }
}